package com.observer.service.impl;

import com.observer.entity.Weather;
import com.observer.service.Display;
import com.observer.service.Observer;
import lombok.Data;
import org.springframework.stereotype.Component;

/**
 * 温度信息展示观察者面板
 *
 * @author LiKun
 * @date 2021/8/5 23:13
 */
@Data
@Component
public class TemperatureObserver implements Observer, Display {
    private Weather weather;

    @Override
    public void update(Object obj) {
        this.weather = (Weather) obj;
        display();
    }

    @Override
    public void display() {
        System.out.println(weather.toString());
    }
}
